﻿using System;
using System.Web.UI.WebControls;
using Menu = NewLife.CommonEntity.Menu;
using NewLife.CommonEntity;

public partial class Center_Frame_Left : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Administrator.Current != null && Administrator.Current.Role != null)
            {
                //Menu m = Menu.FindByName("管理平台");
                Menu m = Menu.Root;
                if (m == null || m.Childs == null || m.Childs.Count < 1) return;
                m = m.Childs[0];
                if (m == null) return;

                menu.DataSource = Administrator.Current.Role.GetMySubMenus(m.ID);
                menu.DataBind();
            }
        }
    }

    protected void menu_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item == null || e.Item.DataItem == null) return;
        Menu m = e.Item.DataItem as Menu;
        if (m == null) return;

        Repeater rp = e.Item.FindControl("menuItem") as Repeater;
        if (rp == null) return;

        rp.DataSource = Administrator.Current.Role.GetMySubMenus(m.ID);
        rp.DataBind();
    }
}